#ifndef CORE_TRIANGLE_H
#define CORE_TRIANGLE_H
#include "Hitable.h"
namespace RayTracer
{
	class Triangle : public Hitable
	{
	public:
		Triangle(const vec3& p1, const vec3& p2, const vec3& p3, std::shared_ptr<Material> mat)
			: a(p1), b(p2), c(p3), matPtr(mat) {}

		virtual bool Hit(const Ray& r, float t_min, float t_max, HitRecord& rec) const;
		bool BoundingBox(AABB& output_box) const { return false; }
	public:
		vec3& P1() { return a; }
		vec3& P2() { return b; }
		vec3& P3() { return c; }
	private:
		void GetTriangleUV(const vec3& p,float& u,float& v) const ;
	private:
		vec3 a;
		vec3 b;
		vec3 c;
		std::shared_ptr<Material> matPtr;
	};
}
#endif // !CORE_TRIANGLE_H
